/*
 * Copyright © 2021 http://www.hn-szzy.com/ All rights reserved.
 */
package com.xjh.controller;


import com.xjh.bo.LogBO;
import com.xjh.service.LogService;
import com.xjh.utils.pageutils.IPage;
import com.xjh.utils.resultutils.ResponseObj;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author： 徐建华
 * @date： 2022/1/2
 * @description：
 */
@RestController
@RequestMapping("/api/log")
public class LogController {
    private final LogService logService;

    public LogController(LogService logService) {
        this.logService = logService;
    }

    //    查询所有日志带分页
    @GetMapping("/page")
    public ResponseObj queryAll(@RequestParam(required = false, defaultValue = "1") Integer pageNum,
                                @RequestParam(required = false, defaultValue = "5") Integer pageSize,
                                @RequestParam(required = false) String orderBy) {

        HashMap<String, Object> conditionMap = new HashMap<>();
        IPage<LogBO> pageModel = logService.page(conditionMap,pageNum, pageSize, orderBy);
        ResponseObj responseObj = new ResponseObj();
        return responseObj.ok(pageModel);
    }
}
